package com.bookmanagement.controller.user;

import com.bookmanagement.result.Result;
import com.bookmanagement.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author skyjay
 */
@RestController
@RequestMapping("/comment")
public class CommentController {
    @Autowired
    private CommentService commentService;
    @PostMapping("/{id}")
    public Result comment(@PathVariable("id") Integer id, @RequestBody String content){
        commentService.comment(id,content);
        return Result.success();
    }

    @DeleteMapping("/{commentId}")
    public Result deleteComment(@PathVariable("commentId") Long commentId){
        commentService.deleteComment(commentId);
        return Result.success();
    }
}
